/**
 * Created by houjianhui on 2017/8/21.
 */
/**
 * Created by Tuffy on 16/8/22.
 */
'use strict';

// 工具类
var Tools = {
    isImportView: false,
    code: '',// 验证码
    layer: {
        alert: function (content, title, callback) {
            var index = layer.alert(content, {
                skin: 'layer-btn-class',
                closeBtn: 0,
                title: title
            }, function(){
                layer.close(index);
                if (callback) callback();
            });
        },
        confirm: function (content, title, okbtn, cancelbtn, okCallback, cancelCallback) {
            var index = layer.confirm(content, {
                title: title,
                skin: 'layer-btn-class',
                btn: [okbtn, cancelbtn]
            }, function(){
                layer.close(index);
                if (okCallback) okCallback();
            }, function(){
                layer.close(index);
                if (cancelCallback) cancelCallback();
            });
        },
        open: function (option) {
            var index = 0;
            var _option = _.extend({
                type: 1,
                title: '页面层',
                shadeClose: true,
                shade: 0.3,
                maxmin: false,
                area: ['60%', '80%'],
                content: '惠运车欢迎你',
                cancel: function () {
                    layer.close(index);
                    if (option.callback)
                        option.callback();
                }
            }, option);
            this.open.index= index = layer.open(_option);
        }
    },
    Bill: {
        getAuditText: function (value) {
            if (value == 20) {
                return '待审核';
            } else if (value == 30) {
                return '通过';
            } else if (value == 40) {
                return '拒绝';
            }
        }
    }
};